<%inherit file="/base.mako"/>

<%def name="head()">
<script src="/media/js/table_action.js" type="text/javascript"></script>
<script type="text/javascript" src="/media/js/jquery.tablesorter.min.js"></script> 
<script type="text/javascript">
$(function() {
	$("table.sortable").tablesorter({
		headers: {
			0 : { sorter : false},
			4 : { sorter : 'text'},
			9 : { sorter : false}
		}
	})
})
</script>
</%def>

<%def name="content()">
% if c.partial_parses:
<table class="sortable">
	<thead>
		<tr>
			<th></th>
			<th>Time</th>
			<th>Video ID</th>
			<th>Title</th>
			<th style="width: 8.5em">Date Played</th>
			<th style="width: 5.5em">Teams</th>
			<th style="width: 6em">Players</th>
			<th style="width: 6em">Game Number</th>
			<th>Possible Results</th>
			<th colspan="2">Actions</th>
		</tr>
	</thead>
	<tbody>
	% for parse in c.partial_parses:
		<tr>
			<td><a href="/you_tube_partial_parse/view/${parse.video_id}">View</a></td>
			<td>${parse.time.strftime('%Y-%m-%d %I:%M %p')}</td>
			<td><a href="http://www.youtube.com/watch?v=${parse.video_id}">${parse.video_id}</a></td>
			<td>${parse.title}</td>
			<td>
				% if len(parse.date_played) == 0:
					<p>None</p>
				% else:
					<ul style="margin-left: 0px">
						% for date_played in parse.date_played:
							<li>${date_played.strftime('%Y-%m-%d')}</li>
						% endfor
					</ul>
				% endif
			</td>
			<td>${parse.teams}</td>
			<td>${parse.players}</td>
			<td>${parse.game_number}</td>
			<td>${len(parse.possible_results)}</td>
			<td><a class="table_action" href="/you_tube_partial_parse/retry_command/${parse.video_id}">Retry</a></td>
			<td><a class="table_action" href="/you_tube_partial_parse/delete_command/${parse.video_id}">Delete</a></td>
		</tr>
	% endfor
	</tbody>
</table>
% else:
	<p>There are currently no youtube partial parses.</p>
% endif
</%def>
